<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('指定产品规格')" />
    <th:block th:include="include :: layout-latest-css" />
    <th:block th:include="include :: ztree-css" />
    <style>
        /*.changeColor{
            background-color: #23c6c8  !important;
            color: white;
        }*/
        .table-hover > tbody > tr:hover > td,
        .table-hover > tbody > tr:hover > th {
            color: #11d14f;
            cursor: pointer;
        }

    </style>
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden" id="partsId" name="partsId" th:value="${partsId}">
                    <input type="hidden" id="oldId" name="oldId" th:value="${oldId}">
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table class="table-hover" id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: layout-latest-js" />
    <th:block th:include="include :: ztree-js" />
    <script th:inline="javascript">
        var partsDistinguishDatas = [[${@dict.getType('parts_brand')}]];
        var prefix = ctx + "zsyh/partsattribute";

        $(function() {
            queryPartsList();
        });
        function queryPartsList() {
            var options = {
                url: prefix + "/list",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                pageSize: 4,
                pageNumber: 1,
                modalName: "规格管理",
                columns: [{
                    field : 'Number',
                    title : '序号',
                    align: 'center',
                    width: 20,
                    formatter : function(value, row, index) {
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;//通过表的#id 可以得到每页多少条
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;//通过表的#id 可以得到当前第几页
                        return pageSize * (pageNumber - 1) + index + 1;//返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
                    }
                },
                {
                    field: 'id',
                    title: '产品Id',
                    visible: false
                },
                    {
                        field: 'attributeLogo',
                        title: '规格主图',
                        formatter: function (value, row, index) {
                            return $.table.imageView(value);
                        }
                    },
                    {
                        field: 'attributeName',
                        title: '规格名称'
                    },
                    {
                        field: 'partsUnit',
                        align: 'center',
                        title: '产品单位'
                    },
                {
                    field: 'factoryName',
                        align: 'center',
                    title: '厂家名称'
                },
                {
                    field: 'attributePayPrice',
                    title: '补助金金额',
                    align: 'center'
                },
                ],onDblClickRow: function (row) {
                    debugger;
                    $.modal.confirm("确认要移动到该规格之后吗？", function() {
                        $.operate.post(prefix + "/moveChange", { "id":row.id,"oldId":$('#oldId').val()},$.modal.close());
                    });
                },
                onClickRow:function (row,$element) {
                    $('.changeColor').removeClass('changeColor');//移除class
                    $($element).addClass('changeColor');//添加class
                }
            };
            $.table.init(options);
        };


    </script>
</body>
</html>